//
//  AliMNSQueue.h
//  AlibabaCloudMNSiOS
//
//  Created by David Chen on 28/03/2017.
//  Copyright © 2017 AliCloud. All rights reserved.
//

#import "AliMNSClient.h"
#import "AliMNSMessage.h"
#import "AliMNSQueueMeta.h"
#import "AliMNSError.h"

@interface AliMNSQueue : NSObject
{
    NSString* mQueueName;
    AliMNSClient* mMNSClient;
}
-(id)initWithQueueName:(NSString*) queueName
           withMNSClient:(AliMNSClient*) mnsCient;

-(NSString*) create:(AliMNSQueueMeta*) queueMeta;

-(AliMNSQueueMeta*) getAttributes;

-(void) setAttributes:(AliMNSQueueMeta*) queueMeta;

-(void) deleteQueue;

-(AliMNSMessage*) sendMessage:(AliMNSMessage*) message;

-(void) asyncSendMessage:(AliMNSMessage*) message
      withSuccessHandler:(void (^)(AliMNSMessage* msg)) sucessHandler
         withFailHandler:(void (^)(AliMNSError* err)) failHandler;

-(NSArray*) batchSendMessage:(NSArray*) messageList;

-(void) asyncBatchSendMessage:(NSArray*) messageList
      withSuccessHandler:(void (^)(NSArray* msgList)) sucessHandler
         withFailHandler:(void (^)(AliMNSError* err)) failHandler;

-(AliMNSMessage*) peekMessage;

-(void) asyncPeekMessageWithSuccessHandler:(void(^)(AliMNSMessage* msg)) successHandler
                      withFailHandler:(void(^)(AliMNSError* err)) failHandler;

-(NSArray*) batchPeekMessage:(NSInteger) batchSize;

-(void) asyncBatchPeekMessage:(NSInteger) batchSize
      withSuccessHandler:(void(^)(NSArray* msgList)) successHandler
         withFailHandler:(void(^)(AliMNSError* err)) failHandler;

-(AliMNSMessage*) receiveMessage:(NSInteger)waitSeconds;

-(void) asyncReceiveMessage:(NSInteger)waitSeconds
              withSuccessHandler:(void(^)(AliMNSMessage* msg)) successHandler
                 withFailHandler:(void(^)(AliMNSError* err)) failHandler;

-(NSArray*) batchReceiveMessage:(NSInteger)waitSeconds
                 withBatchSize:(NSInteger) batchSize;

-(void) asyncBatchReceiveMessage:(NSInteger)waitSeconds
              withBatchSize:(NSInteger) batchSize
         withSuccessHandler:(void(^)(NSArray* msg)) successHandler
         withFailHandler:(void(^)(AliMNSError* err)) failHandler;

-(void) deleteMessage:(NSString*)receiptHandle;

-(void) asyncDeleteMessage:(NSString*)receiptHandle
        withSuccessHandler:(void(^)()) successHandler
           withFailHandler:(void(^)(AliMNSError* err)) failHandler;

-(void) batchDeleteMessage:(NSArray*)receiptHanleList;

-(void) asyncBatchDeleteMessage:(NSArray*)receiptHanleList
             withSuccessHandler:(void(^)()) successHandler
                withFailHandler:(void(^)(AliMNSError* err)) failHandler;

-(AliMNSMessage*) changeMessageVisibility:(NSString*)receiptHandle
                   withVisibilityTimeout:(NSInteger) visibilityTimeout;
@end
